feat: lucky button experiment#6013
Open
rebelchris wants to merge 3 commits intomainfrom
Open
Conversation
Adds a Sparkle-icon button in the main feed control header that fetches a random trending post via the existing randomTrendingPosts resolver and navigates to it. Reuses the same backend random-post logic that powers the "I'm feeling lucky" CTA in BestDiscussions. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Add featureLuckyButton GrowthBook flag (off by default) - Fix click navigation: commentsPermalink is a full URL, so router.push was failing silently; switch to window.location.assign - Move click tracking to fire immediately on click (event_name: Click, target_type: 'lucky button'), not after fetch - Use TanStack useMutation with toast on error so failures are visible - Add hover animation: sparkle rotates and scales on hover, spins while fetching Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Experiment that adds a Sparkle "lucky" button to the main feed
SearchControlHeader(gated byhasFeedActions, same as IntroQuest / AchievementTracker). On click it fetches a random trending post via the existingrandomTrendingPosts(first: 1)resolver and navigates to it.featureLuckyButton(GrowthBook). Off by default in production; gated viauseConditionalFeatureso it only evaluates when auth is ready.randomPostsResolverpattern.LogEvent.Clickwithtarget_type: 'lucky button'fires immediately on click (before the network call).window.location.assignsincecommentsPermalinkis a full URL —router.push(fullUrl)was the silent-click bug.useMutation+ toast ("Bad luck — try again in a moment.") so failed fetches are visible.The existing (no-op) "I'm feeling lucky" CTA in
BestDiscussionsis intentionally untouched.Test plan
lucky_buttonflag → Sparkle button appears on My Feed / Custom feed (desktop).🤖 Generated with Claude Code
Preview domain
https://feat-lucky-button.preview.app.daily.dev